
using System;
using Qdb.CS.Internal.Messages;
using Qdb.Internal;

namespace Qdb.CS.Internal.Messages
{
	public class MObjectByUuid : MsgD, IMessageWithResponse
	{
		public Msg ReplyFromServer()
		{
			long uuid = ReadLong();
			byte[] signature = ReadBytes();
			int id = 0;
			Transaction trans = Transaction();
			lock (StreamLock())
			{
				try
				{
					HardObjectReference hardRef = Stream().GetHardReferenceBySignature(trans, uuid, signature
						);
					if (hardRef._reference != null)
					{
						id = hardRef._reference.GetID();
					}
				}
				catch (Exception e)
				{
				}
			}
			return Msg.ObjectByUuid.GetWriterForInt(trans, id);
		}
	}
}
